import request from '@/utils/request'
import { microservices } from '@/utils'

export function getSysRoleGroup (params) {
  return request({
    url: `${microservices.pmsSys}/SysRoleGroup`,
    params,
    method: 'get'
  })
}

export function putSysRoleGroup (params) {
  return request({
    url: `${microservices.pmsSys}/SysRoleGroup?groupName=${params.groupName}`,
    method: 'put'
  })
}

export function deleteSysRoleGroup (id) {
  return request({
    url: `${microservices.pmsSys}/SysRoleGroup/${id}`,
    method: 'delete'
  })
}

export function postSysRoleGroup (data) {
  return request({
    url: `${microservices.pmsSys}/SysRoleGroup`,
    data,
    method: 'post'
  })
}

export function getSysRole (params) {
  let sortStr = params.sortStr
  delete params.sortStr
  return request({
    url: `${microservices.pmsSys}/SysRole?${sortStr}`,
    params,
    method: 'get'
  })
}

export function putSysRole (data) {
  return request({
    url: `${microservices.pmsSys}/SysRole`,
    data,
    method: 'put'
  })
}

export function deleteSysRole (id) {
  return request({
    url: `${microservices.pmsSys}/SysRole/${id}`,
    method: 'delete'
  })
}

export function postSysRole (data) {
  return request({
    url: `${microservices.pmsSys}/SysRole`,
    data,
    method: 'post'
  })
}

export function getSysMemberRole (params) {
  let sortStr = params.sortStr
  delete params.sortStr
  return request({
    url: `${microservices.pmsSys}/SysMemberRole?${sortStr}`,
    params
  })
}

export function postSysRoleMenuFunc (data) {
  return request({
    url: `${microservices.pmsSys}/SysRoleMenuFunc`,
    data,
    method: 'post'
  })
}

export function getSysMenuFuncCurrTree (params) {
  return request({
    url: `${microservices.pmsSys}/SysMenuFunc/currTree`,
    params
  })
}

export function getSysMenuFuncCurrQueryAuthFunc (params) {
  return request({
    url: `${microservices.pmsSys}/SysMenuFunc/currQueryAuthFunc`,
    params
  })
}

export function getSysRoleMenuFuncQueryByRoleId (id) {
  return request({
    url: `${microservices.pmsSys}/SysRoleMenuFunc/queryByRoleId/${id}`
  })
}
